// 监听视频播放按钮
$('.img-tv-wugeku').on('click', function() {
  _hmt.push(['_trackEvent', 'tv_wugeku', 'click', '0']);
});

$('.img-tv-bar').on('click', function() {
  _hmt.push(['_trackEvent', 'tv_bar', 'click', '0']);
});

$('.img-tv-donglisahu').on('click', function() {
  _hmt.push(['_trackEvent', 'tv_donglisahu', 'click', '0']);
});

$('.img-tv-school').on('click', function() {
  _hmt.push(['_trackEvent', 'tv_school', 'click', '0']);
});

$('.img-tv-cook').on('click', function() {
  _hmt.push(['_trackEvent', 'tv_cook', 'click', '0']);
});

$('.img-tv-feitianwu').on('click', function() {
  _hmt.push(['_trackEvent', 'tv_feitianwu', 'click', '0']);
});

$('.img-tv-madewang').on('click', function() {
  _hmt.push(['_trackEvent', 'tv_madewang', 'click', '0']);
});

$(function () {
  var video1 = document.getElementById('videoPlay1');
  var video2 = document.getElementById('videoPlay2');
  var video3 = document.getElementById('videoPlay3');
  var video4 = document.getElementById('videoPlay4');
  var video5 = document.getElementById('videoPlay5');
  var video6 = document.getElementById('videoPlay6');
  var video7 = document.getElementById('videoPlay7');

  //监听视频
  video1.addEventListener('pause',function () {
    $('.img-tv').show();
    $('.video-play').hide();
  })
  video2.addEventListener('pause',function () {
    $('.img-tv').show();
    $('.video-play').hide();
  })
  video3.addEventListener('pause',function () {
    $('.img-tv').show();
    $('.video-play').hide();
  })
  video4.addEventListener('pause',function () {
    $('.img-tv').show();
    $('.video-play').hide();
  })
  video5.addEventListener('pause',function () {
    $('.img-tv').show();
    $('.video-play').hide();
  })
  video6.addEventListener('pause',function () {
    $('.img-tv').show();
    $('.video-play').hide();
  })
  video7.addEventListener('pause',function () {
    $('.img-tv').show();
    $('.video-play').hide();
  })

  //打开视频
  $('.img-tv-wugeku').on('click',function () {
    video1.play();
    $('#videoPlay1').show();
    $('.img-tv-wugeku').hide();
  })
  $('.img-tv-bar').on('click',function () {
    video2.play();
    $('#videoPlay2').show();
    $('.img-tv-bar').hide();
  })
  $('.img-tv-donglisahu').on('click',function () {
    video3.play();
    $('#videoPlay3').show();
    $('.img-tv-donglisahu').hide();
  })
  $('.img-tv-school').on('click',function () {
    video4.play();
    $('#videoPlay4').show();
    $('.img-tv-school').hide();
  })
  $('.img-tv-cook').on('click',function () {
    video5.play();
    $('#videoPlay5').show();
    $('.img-tv-cook').hide();
  })
  $('.img-tv-feitianwu').on('click',function () {
    video6.play();
    $('#videoPlay6').show();
    $('.img-tv-feitianwu').hide();
  })
  $('.img-tv-madewang').on('click',function () {
    video7.play();
    $('#videoPlay7').show();
    $('.img-tv-madewang').hide();
  })

  //跳转店铺
  $('.to-shop').on('click',function () {
    var index = $(this).attr('index');
    if(index == 1){
      window.location.href="https://items.alitrip.com/item.htm?spm=a1z10.5-b-s.w4011-14872953958.102.wieBku&id=540017875224&rn=88ea92b7c53aa4c0575361afbc030d48&abbucket=10";
    }else if(index == 2){
      window.location.href="https://items.alitrip.com/item.htm?spm=a220z.1000880.0.0.f93kDQ&id=542907989499";
    }else if(index == 3){
      window.location.href="https://items.alitrip.com/item.htm?spm=a1z10.5-b-s.w4011-14872953958.91.wieBku&id=539965084194&rn=88ea92b7c53aa4c0575361afbc030d48&abbucket=10";
    }else if(index == 4){
      window.location.href="https://items.alitrip.com/item.htm?spm=a220z.1000880.0.0.f93kDQ&id=542888268788";
    }else if(index == 5){
      window.location.href="https://items.alitrip.com/item.htm?spm=a1z10.5-b-s.w4011-14872953958.110.wieBku&id=542120902592&rn=88ea92b7c53aa4c0575361afbc030d48&abbucket=10";
    }else if(index == 6){
      window.location.href="https://items.alitrip.com/item.htm?spm=a1z10.5-b-s.w4011-14872953958.100.wieBku&id=542329602547&rn=88ea92b7c53aa4c0575361afbc03";
    }else if(index == 7){
      window.location.href="http://shop.m.taobao.com/shop/coupon.htm?activityId=92d5302d3f734faba19dd2a5b92b5eae&sellerId=889747933";
    }
  })
})
